OneEuroFilter-ts
This code is a translation to Typescript of the original code from Jaan Tollander.
It's not well tested yet, so I can not assure of the correctness of the code.
Installation
Install with npm:
npm install @webarkit/oneeurofilter-ts
Install with yarn:
yarn add @webarkit/oneeurofilter-ts
Usage
In a typescript file:
import { OneEuroFilter } from "@webarkit/oneeurofilter-ts";
let filterMinCF: number = 0.0001;
let filterBeta: number = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);
let yourData = createData();
filter.filter(Date.now(), yourData);
In a javascript file:
import { OneEuroFilter } from "@webarkit/oneeurofilter-ts";
let filterMinCF = 0.0001;
let filterBeta = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);
let yourData = createData();
filter.filter(Date.now(), yourData);
in a html script tag with module support:
<script type="importmap">
{
"imports": {
"oef": "https://raw.github.com/webarkit/oneeurofilter-ts/main/dist/OneEuroFilter.mjs",
}
}
</script>
// import the OneEuroFilter class into your project
<script type="module">
import { OneEuroFilter } from "oef";
let filterMinCF = 0.0001;
let filterBeta = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);
let yourData = createData();
filter.filter(Date.now(), yourData);
</script>